#ifndef DATATYPEDICTIONARY_H
#define DATATYPEDICTIONARY_H

#include <QDebug>
#include <QAbstractListModel>
#include <QList>
#include <QListIterator>
#include <QString>

#include "xmidatatype.h"

class DatatypeDictionary : public QAbstractListModel
{
public:
    DatatypeDictionary(QObject *parent = 0);
    ~DatatypeDictionary();

    void insert(QString id, QString label, bool isPrimitive = false);
    void removeByLabel(QString label);

    XmiDatatype dataTypeByLabel(QString label) const;
    XmiDatatype datatypeById(QString id);
    QString labelById(QString id);
    QList<XmiDatatype> datatypeList() const;
    bool containsLabel(QString label);

    // Model
    QVariant data(const QModelIndex &index, int role) const;
    int rowCount(const QModelIndex &parent) const;
    int indexByLabel(QString label);

private:
    QList<XmiDatatype> _list;
};

#endif // DATATYPEDICTIONARY_H
